home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / sbin / lrm-manager < prev    next >
Encoding:
Text File  |  2007-05-23  |  2.2 KB  |  88 lines

  1. #!/bin/sh
  2.  
  3. # Note that this script is not only /sbin/lrm-manager, but it also
  4. # ends up being the postinst for nic-restricted-modules.  Take care
  5. # when adding features to make sure they'll work in d-i's busybox
  6.  
  7. # If you wish to disable the link-on-boot feature for certain modules,
  8. # please see /etc/default/linux-restricted-modules-common for details.
  9.  
  10. set -e
  11.  
  12. KVER="$(uname -r)"
  13. DEPMOD=yes
  14.  
  15. while [ $# -gt 0 ]; do
  16.   case "$1" in
  17.     --kver=*)    KVER="${1#--kver=}"; shift ;;
  18.     --quick)    DEPMOD=no; shift ;;
  19.     --help)    echo "Usage: $0 [ --quick ] [ --kver=KERNEL_VERSION ]"; exit 0 ;;
  20.     *)        shift ;;
  21.   esac
  22. done
  23.  
  24. if [ -f /etc/default/linux-restricted-modules-common ] && [ "$DEPMOD" = "no" ]; then
  25.   . /etc/default/linux-restricted-modules-common
  26. fi
  27.  
  28. # check if we have the kernel objects
  29.  
  30. if [ ! -d /lib/linux-restricted-modules/"$KVER" ]; then
  31.   exit 0
  32. fi
  33.  
  34. # if tmpfs is already mounted, skip it.
  35. # NOTE that at this point in time we have no /proc or other fancy things to check
  36.  
  37. if [ ! -f /lib/modules/"$KVER"/volatile/.mounted ]; then
  38.   mkdir -p /lib/modules/"$KVER"/volatile/
  39.   mount -t tmpfs -o mode=0755 tmpfs /lib/modules/"$KVER"/volatile/
  40.   touch /lib/modules/"$KVER"/volatile/.mounted
  41. fi
  42.  
  43. cd /lib/linux-restricted-modules/"$KVER"
  44. for module in *; do
  45.   CURRENT_MODULE_DISABLED="false"
  46.   set -- $DISABLED_MODULES
  47.   while [ $# -gt 0 ]; do
  48.     case "$1" in
  49.       fc)
  50.         set -- $@ fcdsl fcdsl2 fcdslsl fcdslslusb fcdslusb fcdslusb2 fcdslusba fcpci fcusb fxusb
  51.         shift
  52.         ;;
  53.       nv)
  54.         set -- $@ nvidia nvidia_legacy
  55.         shift
  56.         ;;
  57.       ltm)
  58.         set -- $@ ltmodem ltserial
  59.         shift
  60.         ;;
  61.       *)
  62.         if [ "$1" = "$module" ]; then
  63.           CURRENT_MODULE_DISABLED="true"
  64.           break
  65.         else
  66.           shift
  67.         fi
  68.         ;;
  69.     esac
  70.   done
  71.   if [ "$CURRENT_MODULE_DISABLED" = "false" ]; then
  72.     if type ld_static >/dev/null 2>&1; then
  73.       ld_static -d -r -o /lib/modules/"$KVER"/volatile/$module.ko $module/* || true
  74.     fi
  75.   fi
  76. done
  77.  
  78. if [ "$DEPMOD" = "yes" ]; then
  79.   if [ -f "/boot/System.map-$KVER" ]; then
  80.     depmod -a -q -F /boot/System.map-"$KVER" "$KVER"
  81.   elif type udpkg >/dev/null 2>&1; then
  82.     # Running in d-i
  83.     depmod -a -q
  84.   fi
  85. fi
  86.  
  87. exit 0
  88.